package com.hzeport.bgs22emduty.inbound.api;

import com.hzeport.bgs22emduty.config.systemLog.OperLog;
import com.hzeport.bgs22emduty.dto.ScreenDutyNoticeListDTO;
import com.hzeport.bgs22emduty.dto.ScreenDutyNoticeListSaveDTO;
import com.hzeport.bgs22emduty.service.BaseDeptInfoService;
import com.hzeport.bgs22emduty.common.base.BaseResult;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzeport.bgs22emduty.entity.ScreenDutyNoticeList;
import com.hzeport.bgs22emduty.service.ScreenDutyNoticeListService;
//import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ${comments}
 *
 * @author code generator
 * @date 2023-02-14 09:39:44
 */
@RestController
@AllArgsConstructor
@RequestMapping("/screendutynoticelist")
@Api(value = "screendutynoticelist", tags = "值班提醒管理")
@Slf4j
public class ScreenDutyNoticeListController {

    private final ScreenDutyNoticeListService screenDutyNoticeListService;

    @Resource
    private BaseDeptInfoService baseDeptInfoService;

    @ApiOperation(value = "分页查询", notes = "分页查询")
    @PostMapping("/page")
    public BaseResult getScreenDutyNoticeListPage(@RequestBody ScreenDutyNoticeListDTO dto) {
        return BaseResult.ok(screenDutyNoticeListService.page(dto));
    }

    @ApiOperation(value = "获取短信发送人员的信息", notes = "获取短信发送人员的信息")
    @PostMapping("getPersonInfoToSmsMessage")
    public BaseResult getPersonInfoToSmsMessage(@RequestParam String type) {
        return BaseResult.ok(baseDeptInfoService.getPersonInfoTOSmsMessage(type));
    }

    @ApiOperation(value = "新增", notes = "新增")
    @PostMapping("save")
    @OperLog( systemName = "ZBTX", description = "TXXZ")
    public BaseResult save(@RequestBody ScreenDutyNoticeListSaveDTO dto) throws Exception {
        return BaseResult.ok(screenDutyNoticeListService.save(dto));
    }

    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}")
    public BaseResult getById(@PathVariable("id") String id) {
        return BaseResult.ok(screenDutyNoticeListService.detailById(id));
    }

    @ApiOperation(value = "修改", notes = "修改")
    @PostMapping("updateById")
    @OperLog( systemName = "ZBTX", description = "TXGZ")
    public BaseResult updateById(@RequestBody ScreenDutyNoticeListSaveDTO dto) {
        return BaseResult.ok(screenDutyNoticeListService.updateById(dto));
    }

    /**
     * 通过id删除${comments}
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除${comments}", notes = "通过id删除${comments}")
    //@SysLog(.*)
    @DeleteMapping("/{id}")
    @OperLog( systemName = "ZBTX", description = "TXSC")
    public BaseResult removeById(@PathVariable String id) {
        return BaseResult.ok(screenDutyNoticeListService.removeById(id));
    }

}
